<%@ Page Language="C#" MasterPageFile="~/MasterPages/AdminDefault.Master" AutoEventWireup="true"
  CodeBehind="Groups.aspx.cs" Inherits="NguyenHoa.Web.Admin.Groups" Title="" %>

<%@ Register Assembly="DevExpress.Web.v9.1, Version=9.1.4.0, Culture=neutral, PublicKeyToken=5377c8e3b72b4073"
  Namespace="DevExpress.Web.ASPxPopupControl" TagPrefix="dxpc" %>
<%@ Register Assembly="DevExpress.Web.ASPxGridView.v9.1, Version=9.1.4.0, Culture=neutral, PublicKeyToken=5377c8e3b72b4073"
  Namespace="DevExpress.Web.ASPxGridView" TagPrefix="dxwgv" %>
<%@ Register Assembly="DevExpress.Web.ASPxEditors.v9.1, Version=9.1.4.0, Culture=neutral, PublicKeyToken=5377c8e3b72b4073"
  Namespace="DevExpress.Web.ASPxEditors" TagPrefix="dxe" %>
<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
  <div>
    <dxwgv:ASPxGridView ID="gvGroup" runat="server" AutoGenerateColumns="False" Width="600px"
      ClientInstanceName="gvGroup" OnCustomCallback="gvGroup_CustomCallback" OnCustomJSProperties="gvGroup_CustomJSProperties"
      KeyFieldName="Id" OnRowDeleting="gvGroup_RowDeleting" OnRowInserting="gvGroup_RowInserting"
      OnRowUpdating="gvGroup_RowUpdating" OnCommandButtonInitialize="gvGroup_CommandButtonInitialize"
      OnDataBound="gvGroup_DataBound">
      <ClientSideEvents EndCallback="function(s, e) {gvGroup_EndCallback(s, e);}" />
      <SettingsBehavior ConfirmDelete="True" AllowDragDrop="false" AllowSort="false" />
      <SettingsLoadingPanel Text="" />
      <SettingsPager>
        <AllButton>
          <Image Height="19px" Width="28px" />
        </AllButton>
        <FirstPageButton>
          <Image Height="19px" Width="23px" />
        </FirstPageButton>
        <LastPageButton>
          <Image Height="19px" Width="23px" />
        </LastPageButton>
        <NextPageButton>
          <Image Height="19px" Width="19px" />
        </NextPageButton>
        <PrevPageButton>
          <Image Height="19px" Width="19px" />
        </PrevPageButton>
      </SettingsPager>
      <SettingsEditing Mode="Inline" />
      <SettingsText ConfirmDelete="<%$Resources:Messages, ERR0006 %>" />
      <Columns>
        <dxwgv:GridViewCommandColumn Name="Command" ButtonType="Image" VisibleIndex="0" 
          Width="60px" Caption=" ">
          <EditButton Visible="True">
            <Image Url="~/images/edit.png" />
          </EditButton>
          <NewButton Visible="True">
            <Image Url="~/images/add.png" />
          </NewButton>
          <DeleteButton Visible="True">
            <Image Url="~/images/delete.png" />
          </DeleteButton>
          <CancelButton>
            <Image Url="~/images/undo.gif" />
          </CancelButton>
          <UpdateButton>
            <Image Url="~/images/save.png" />
          </UpdateButton>
          <HeaderStyle HorizontalAlign="Center" />
        </dxwgv:GridViewCommandColumn>
        <dxwgv:GridViewDataTextColumn VisibleIndex="1" Caption="<%$ Resources:Strings, Name %>"
          FieldName="Name">
          <HeaderStyle HorizontalAlign="Center" />
          <DataItemTemplate>
            <span onclick="showDetail('<%#Eval("Id") %>')" class="LinkItem" style="cursor: pointer;">
              <%#Eval("Name") %>
            </span>
          </DataItemTemplate>
        </dxwgv:GridViewDataTextColumn>
        <dxwgv:GridViewDataTextColumn FieldName="Description" VisibleIndex="2" Caption="<%$ Resources:Strings, Description %>">
          <HeaderStyle HorizontalAlign="Center" />
        </dxwgv:GridViewDataTextColumn>
        <dxwgv:GridViewDataCheckColumn FieldName="IsActive" VisibleIndex="2" Caption="<%$ Resources:Strings, Active %>">
          <HeaderStyle HorizontalAlign="Center" />
        </dxwgv:GridViewDataCheckColumn>
      </Columns>
      <Paddings Padding="1px" />
      <StylesEditors>
        <ProgressBar Height="29px">
        </ProgressBar>
      </StylesEditors>
    </dxwgv:ASPxGridView>
  </div>
  <div>
  </div>

  <script type="text/javascript" language="javascript">
    function onCancel() {
      pcEditGroup.Hide();
    }

    function onEdit(groupId, name, note) {
      txtName.SetText(name);
      mmNote.SetText(note);
      gvPermission.PerformCallback('Edit|' + groupId);
    }

    function onAdd() {
      resetValue();
      gvPermission.PerformCallback('Edit|' + 0);
    }

    function onDelete(groupId) {
      if (confirm('<%=GetGlobalResourceObject("Messages","ERR0029") %>'))
        gvGroup.PerformCallback('Delete|' + groupid);
    }

    function gvGroup_EndCallback(s, e) {
      var error = gvGroup.cpInnerError;
      if (error != '')
        alertMessage(error);
    }

    function showDetail(groupId) {
      window.location.href = 'GroupDetail.aspx?Id=' + groupId;
    }

    function showPermission(groupId) {
    }

    function gvPermission_EndCallback(s, e) {
      pcEditGroup.Show();
    }

    function resetValue() {
      txtName.SetText('');
      mmNote.SetText('');
    }
  </script>

</asp:Content>
